package com.example.websocketdemo.service.SHISHI.Timing;

import com.alibaba.fastjson.JSONObject;
import com.example.websocketdemo.service.SHISHI.SHISHIRealTimeTankFarmDataService;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class RealTimeTankFarmData {
    //静态变量
    private static String T101_temperature;
    private static String T101_liquidLevel;
    private static String T102_temperature;
    private static String T102_liquidLevel;
    private static String T103_temperature;
    private static String T103_liquidLevel;
    private static String T104_temperature;
    private static String T104_liquidLevel;
    private static String T105_temperature;
    private static String T105_liquidLevel;
    private static String T106_temperature;
    private static String T106_liquidLevel;
    private static String T107_temperature;
    private static String T107_liquidLevel;
    private static String T108_temperature;
    private static String T108_liquidLevel;
    private static String T109_temperature;
    private static String T109_liquidLevel;
    private static String T110_temperature;
    private static String T110_liquidLevel;
    private static String T111_temperature;
    private static String T111_liquidLevel;
    private static String T112_temperature;
    private static String T112_liquidLevel;
    private static String T113_temperature;
    private static String T113_liquidLevel;
    private static String T114_temperature;
    private static String T114_liquidLevel;
    private static String T115_temperature;
    private static String T115_liquidLevel;


    //判断
    public void transferParameters(String bitNumber, Double AV) throws IOException {
        if (bitNumber.contains("SCADA_A_LT1011")) {
            T101_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1011")) {
            T101_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1021")) {
            T102_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1021")) {
            T102_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1031")) {
            T103_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1031")) {
            T103_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1041")) {
            T104_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1041")) {
            T104_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1051")) {
            T105_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1051")) {
            T105_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1061")) {
            T106_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1061")) {
            T106_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1071")) {
            T107_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1071")) {
            T107_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1081")) {
            T108_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1081")) {
            T108_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1091")) {
            T109_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1091")) {
            T109_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1101")) {
            T110_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1101")) {
            T110_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1111")) {
            T111_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1111")) {
            T111_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1121")) {
            T112_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1121")) {
            T112_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1131")) {
            T113_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1131")) {
            T113_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1141")) {
            T114_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1141")) {
            T114_temperature = String.format("%.2f", AV) + " ℃";
        } else if (bitNumber.contains("SCADA_A_LT1151")) {
            T115_liquidLevel = String.format("%.2f", AV) + " m";
        } else if (bitNumber.contains("SCADA_A_TT1151")) {
            T115_temperature = String.format("%.2f", AV) + " ℃";
        }
    }

    public void en() {
        Map<String, String> map = new HashMap<>();
        map.put("SCADA_A_LT1011", T101_liquidLevel);
        map.put("SCADA_A_TT1011", T101_temperature);
        map.put("SCADA_A_LT1021", T102_liquidLevel);
        map.put("SCADA_A_TT1021", T102_temperature);
        map.put("SCADA_A_LT1031", T103_liquidLevel);
        map.put("SCADA_A_TT1031", T103_temperature);
        map.put("SCADA_A_LT1041", T104_liquidLevel);
        map.put("SCADA_A_TT1041", T104_temperature);
        map.put("SCADA_A_LT1051", T105_liquidLevel);
        map.put("SCADA_A_TT1051", T105_temperature);
        map.put("SCADA_A_LT1061", T106_liquidLevel);
        map.put("SCADA_A_TT1061", T106_temperature);
        map.put("SCADA_A_LT1071", T107_liquidLevel);
        map.put("SCADA_A_TT1071", T107_temperature);
        map.put("SCADA_A_LT1081", T108_liquidLevel);
        map.put("SCADA_A_TT1081", T108_temperature);
        map.put("SCADA_A_LT1091", T109_liquidLevel);
        map.put("SCADA_A_TT1091", T109_temperature);
        map.put("SCADA_A_LT1101", T110_liquidLevel);
        map.put("SCADA_A_TT1101", T110_temperature);
        map.put("SCADA_A_LT1111", T111_liquidLevel);
        map.put("SCADA_A_TT1111", T111_temperature);
        map.put("SCADA_A_LT1121", T112_liquidLevel);
        map.put("SCADA_A_TT1121", T112_temperature);
        map.put("SCADA_A_LT1131", T113_liquidLevel);
        map.put("SCADA_A_TT1131", T113_temperature);
        map.put("SCADA_A_LT1141", T114_liquidLevel);
        map.put("SCADA_A_TT1141", T114_temperature);
        map.put("SCADA_A_LT1151", T115_liquidLevel);
        map.put("SCADA_A_TT1151", T115_temperature);
    }
}
